﻿using System;

namespace PSE.Framework.Messaging
{
    /// <summary>
    /// Provides data for the MsmqSender.OnError event.
    /// </summary>
    public class ErrorEventArgs : EventArgs
    {
        private Exception _exception;
        private int _errorCode;

        /// <summary>
        /// Gets the code that identifies the error.
        /// </summary>
        public int ErrorCode
        {
            get { return _errorCode; }
        }

        /// <summary>
        /// Gets the System.Exception that represents the error that occurred.
        /// </summary>
        public Exception Exception
        {
            get { return _exception; }
        }

        /// <summary>
        /// Initializes a new instance of the MsmqEventArgs class.
        /// </summary>
        /// <param name="errorCode">The error's code.</param>
        /// <param name="exception">An System.Exception that represents the error that occurred.</param>        
        public ErrorEventArgs(int errorCode,  Exception exception)
        {
            _errorCode = errorCode;
            _exception = exception;
        }
    }
}
